<script>
	import autoUpdater from 'common/autoUpdater.min.js';
	export default {
		onLaunch: function() {
			console.log('App Launch')
			plus.runtime.getProperty(plus.runtime.appid, (info) => {
				uni.request({
					url: 'http://47.100.232.30:8081/app/upload',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						'version': info.version,
						'name': info.name
					},
					success: (t) => {
						if (t.data.payload.update === 'false') {
							return;
						}
						autoUpdater.init({		
							packageUrl: t.data.payload.url,
							content: '更新内容:\n' + t.data.payload.info,
							contentAlign: 'left',
							cancel: '取消该版本',
							cancelColor: '#007fff'
						});
						autoUpdater.show();
					},
					fail: () => {
						console.log('请求失败！！！')
					}
				})
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	 @import './common/uni.css';
	 .icon {
	   width: 1em;
	   height: 1em;
	   vertical-align: -0.15em;
	   fill: currentColor;
	   overflow: hidden;
	 }
</style>
